# 7、
# 字典



dict1={"name":"zhangsan"}
# 1.增加元素：key=address，value="河南郑州"
# dict1.setdefault('address','zz')
# print(dict1)

# 2.获取所有的item并打印
# print(dict1.items())

# 3.获取所有的key并打印
# print(dict1.keys())

# 4.获取address的值并打印（分别用两种形式完成：若键不存在时不能报错，键不存在时报错）
# get=dict1.get('address')
# print(get)
# print(dict1.pop('address'))

# 6.修改键“name”的值为：“lisi”
# dict1['name']='lisi'
# print(dict1)

# 7.分别查看字典dict1的长度及类型，并打印
# print(len(dict1),type(dict1))

# 8.清空字典dict1，并打印
# dict1.clear()
# print(dict1)

# 9.定义一个空字典，dict2
# dict2={}
# print(type(dict2))

# 8、将元组（90,30,99,89,50,70,60,60,40,50,60）去重并从小到大排序。
# tup=(90,30,99,89,50,70,60,60,40,50,60)
# s=set(tup)
# t=list(s)
# for i in range(0,len(t)):
#     for j in range(0,len(t)-1):
#         if t[j]>t[j+1]:
#             t[j],t[j+1]=t[j+1],t[j]
#     print(t)
# tup1=tuple(t)
# print(tup1,type(tup1))


# 11、
# 猜拳游戏，用户输入剪刀(0)  石头(1)  布(2)，与电脑程序随机生成一个数字范围在(0,2),来判断是获胜、平局，还是输了。
# 注：随机数使用代码：rm=random.randint(0,2)
# import random
# rm=random.randint(0,2)
# a=int(input('请输入0-2：'))
# print(rm)
# if a==rm:
#     print('p')
# elif a>2 or a<0:
#     print('error')
# elif a-rm==1 or a-rm==-2:
#     print('w')
# else:
#     print('l')

# 13.打印九九乘法口诀
# for i in range(1,10):
#     for j in range(1,i+1):
#         print(f'{j}*{i}={j*i}',end=' ')
#     print()

# 14.
# 1.打印出1~100之间的偶数
# a=2
# while a <= 100:
#     print(a)
#     a+=2

# 2.计算1~100之间共多少个偶数
# a=2
# b=0
# while a <= 100:
#     b+=1
#     a+=2
# print(b)

# 3.计算1~100之间偶数的累积和
# a=2
# b=0
# while a <= 100:
#     b = b + a
#     a+=2
# print(b)


#
# for循环遍历列表，不为空则输出列表中内容，为空则输出为空的提示信息。
# while循环，满足条件时输出内容，不满足时输出跳出循环的提示。
#
#
# 13、
score=[90,30,99,89,50,70,60,60,40,50,60]
# 1.给成绩排序，从高到低，并打印出新成绩列表，同时打印出总的循环次数（for循环）
# p=0
# for i in range(0,len(score)):
#     for j in range(0,len(score)-1):
#         if score[j]<score[j+1]:
#             score[j],score[j+1]=score[j+1],score[j]
#             p+=1
#     print(score)
# print(p)

# 2.统计成绩中60的个数（for循环）
# count=0
# for i in score:
#     if i !=60:
#         continue
#
#     count+=1
# print(count)

# 3.查找成绩中是否有某个分数，若有打印出来并说明存在，
# 若不存在，打印出：未找到（使用while循环））
# f=0
# m=999
# u=0
# while f<len(score):
#     if score[f]==m:
#         print('有')
#         u=1
#         break
#     f+=1
# if u==0:
#     print('wu')

# 15、
# score = [90, 30, 99, 89, 50, 70, 60, 60, 40, 50, 60]，按照从大到小进行排列
# for i in range(0,len(score)):
#     for j in range(0,len(score)-1):
#         if score[j]<score[j+1]:
#             score[j],score[j+1]=score[j+1],score[j]
#             print(score)


# 16、通过键盘获取两个数，用三元表达式赋值法将最小值赋给变量：iMin
# a=int(input('a:'))
# b=int(input('b:'))
# imin =a if a<b else b
# print(imin)

# 打印1-100的偶数
# l=[i for i in range(2,101,2)]
#打印1-100的偶数并且能被4整除
# l=[i for i in range(2,101,2) if i%4==0]
#打印偶数奇数
# l=[i if i%2==0 else 'jishu' for i in range(1,101)]
# print(l)

# i=[4,5,'m','h',9]
# l=[x for x in i if isinstance(x,int)]
# print(l)

# t=(1,2,(3,4))
# l=(1,2,[3,4])
# t1=copy.copy(t)
# l1=copy.copy(l)
#
# print(t,id(t),
#       l,id(l),
#       t1,id(t1),
#       l1,id(l1))
# t2=copy.deepcopy(t)
# l2=copy.deepcopy(l)
#
# print(t2,id(t2),
#       l2,id(l2))
#
# l[2].append(5)
# print(t,id(t),
#       l,id(l),
#       t1,id(t1),
#       l1,id(l1),
#       t2,id(t2),
#       l2,id(l2))
# n=2
# x = 1
# for i in (1, n + 1):
#     x = x * i
#
# print(x)
class JSQ321():
    def jia(self,a,b):
        try:
            c=a+b
        except Exception as e:
            print(f'error:{e}')
        else:
            print('yes,no error')
        finally:
            print('end')
b=JSQ321()
b.jia(7,'c')